TWB.New_Module({
	///////////////////////////
	name : "Stats",          //
	author : "enduo",        //
	version : 1.0,           //
	///////////////////////////
	
	Launch : function(){
		switch(TWB.Modules.Icons.Screen()){
			case "info_village" :
				var vil_id=TWB.URL().match(/id=(\d+)/)[1];
				if(TWB.language=="en"){
					url="http://twstats.com/"+TWB.language+TWB.World()+"/index.php?page=village&id="+vil_id;
				}
				else{
					if(TWB.language=="cs"){
						url="http://cz.twstats.com/cs"+TWB.World()+"/index.php?page=village&id="+vil_id;
					}
					else{
						url="http://"+TWB.language+".twstats.com/"+TWB.language+TWB.World()+"/index.php?page=village&id="+vil_id;
					}
				}
			break;
			
			case "info_player" :
				var play_id=TWB.URL().match(/id=(\d+)/)[1];
				if(TWB.language=="en"){
					url="http://twstats.com/"+TWB.language+TWB.World()+"/index.php?page=player&id="+play_id;
				}
				else{
					if(TWB.language=="cs"){
						url="http://cz.twstats.com/cs"+TWB.World()+"/index.php?page=player&id="+play_id;
					}
					else{
						url="http://"+TWB.language+".twstats.com/"+TWB.language+TWB.World()+"/index.php?page=player&id="+play_id;
					}
				}
			break;
			
			case "info_ally" :
				var tribe_id=TWB.URL().match(/id=(\d+)/)[1];
				if(TWB.language=="en"){
					url="http://twstats.com/"+TWB.language+TWB.World()+"/index.php?page=tribe&id="+tribe_id;
				}
				else{
					if(TWB.language=="cs"){
						url="http://cz.twstats.com/cs"+TWB.World()+"/index.php?page=tribe&id="+tribe_id;
					}
					else{
						url="http://"+TWB.language+".twstats.com/"+TWB.language+TWB.World()+"/index.php?page=tribe&id="+tribe_id;
					}
				}
			break;

			case "ally" :
				var WN=TWB._window();
				if(typeof WN.wrappedJSObject!="undefined"){
					WN=WN.wrappedJSObject;
				}
				if(TWB.language=="en"){
					url="http://twstats.com/"+TWB.language+TWB.World()+"/index.php?page=tribe&id="+WN.game_data.player.ally_id;
				}
				else{
					if(TWB.language=="cs"){
						url="http://cz.twstats.com/cs"+TWB.World()+"/index.php?page=tribe&id="+WN.game_data.player.ally_id;
					}
					else{
						url="http://"+TWB.language+".twstats.com/"+TWB.language+TWB.World()+"/index.php?page=tribe&id="+WN.game_data.player.ally_id;
					}
				}
			break;
			
			default :
				var WN=TWB._window();
				if(typeof WN.wrappedJSObject!="undefined"){
					WN=WN.wrappedJSObject;
				}
				if(TWB.language=="en"){
					url="http://twstats.com/"+TWB.language+TWB.World()+"/index.php?page=player&id="+WN.game_data.player.id;
				}
				else{
					if(TWB.language=="cs"){
						url="http://cz.twstats.com/cs"+TWB.World()+"/index.php?page=player&id="+WN.game_data.player.id;
					}
					else{
						url="http://"+TWB.language+".twstats.com/"+TWB.language+TWB.World()+"/index.php?page=player&id="+WN.game_data.player.id;
					}
				}
			break;
		}
		Load_Master_Url(url);
	}
});